#include <Windows.h>
#include "C/LzmaDec.h"

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved) 
{
	switch (ulReason)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}

static void *SzAlloc(void *p, size_t size)
{
	return malloc(size);
}

static void SzFree(void *p, void *address)
{
	free(address); 
}

ISzAlloc* Lzma_GetDefaultAllocator()
{
	static ISzAlloc alloc = { SzAlloc, SzFree };
	return &alloc;
}

CLzmaDec* LzmaDec_Create()
{
	CLzmaDec *p = (CLzmaDec *)malloc(sizeof(CLzmaDec));
	if (p != NULL)
	{
		LzmaDec_Construct(p);
	}
	return p;
}

void LzmaDec_Destroy(CLzmaDec *p)
{
	free(p);
}
